package com.iris.live.services.data.repositories;

import com.iris.live.services.data.models.Lsh精品促销Model;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by sxy on 2016/7/11.
 */
@Transactional
public interface Lsh精品促销Repository extends JpaRepository<Lsh精品促销Model, Integer>, JpaSpecificationExecutor<Lsh精品促销Model> {

    Lsh精品促销Model findBy精品编号And许可(int productId, String source);

    @Query("select a from Lsh精品促销Model a where a.精品编号=?1 and a.许可=?2")
    Lsh精品促销Model findBy许可And精品编号(Integer id,String permit);

    /**
     *  根据精品编号查找促销信息
     * @param productId 精品编号
     * @return 返回
     */
    @Query("select a from Lsh精品促销Model a where a.精品编号 = ?1")
    Lsh精品促销Model findByProductId(Integer productId);

}
